<?php
namespace app\common;

class Controller
{
    public function __construct()
    {
        
    }
    
    public function redirect($url, $statusCode = 302)
    {
        http_response_code($statusCode);
        header(sprintf("Location: %s", url($url)));
    }
    
    public function outjson($code = 0, $msg = 'OK', array $data = [], $statusCode = 200)
    {
        http_response_code($statusCode);
        header("Content-Type: application/json");
        return json_encode([
            'code' => $code,
            'msg' => $msg,
            'data' => $data
        ]);
    }
}